package com.siruier.boss.ui.activity.commom

import com.siruier.boss.App
import com.siruier.boss.databinding.ActivitySplashBinding
import com.siruier.boss.ui.activity.login.LoginActivity
import com.siruier.boss.ui.activity.main.MainActivity
import com.siruier.boss.ui.base.BaseActivity
import com.siruier.boss.ui.cache.UserCache
import com.siruier.boss.ui.ext.startActivityExt
import me.jessyan.autosize.internal.CancelAdapt

class SplashActivity : BaseActivity<ActivitySplashBinding>(), CancelAdapt {
    override fun initData() {
        App.init()
        if (UserCache.isLogin) {
            goMain()
        } else {
            startActivityExt<LoginActivity>()
        }
    }

    private fun goMain() {
        startActivityExt<MainActivity>()
        finish()
        overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out)
    }
}